# -*- encoding: utf-8 -*-
'''
@文件        :user.py
@Description:       : 用户表模型
@Date     :2025/11/11 11:47:04
@Author      :lin
@version      :1.0
'''
from tortoise import fields
from app.models.base import BaseModel



# User 表模型
class User(BaseModel):
    username = fields.CharField(max_length=32, unique=True, description="用户名")
    password_hash = fields.CharField(max_length=128, description="密码哈希")
    email = fields.CharField(max_length=64, unique=True, null=True, description="邮箱")
    is_active = fields.BooleanField(default=True, description="是否激活")
    note = fields.TextField(null=True, description="备注")

    class Meta:
        table = "users"
        table_description = "用户表"

    def __str__(self):
        return f"<User {self.username}>"
